//我的地图顶部导航栏 组件
import React, { Children } from "react";
import {NavBar}from "antd-mobile-v2"
import withHook from "../../utils/Withhook"
// import "./index.scss"
import styles from './index.module.css'
// 导入 props 校验的包
import PropTypes from 'prop-types'
class NavHeader extends React.Component{
    //this.props.title文字标题
    //this.props.onleftClike 左击事件
    //this.classname 类名
    //rightContent 数组，用于渲染navbar
    constructor(props){
        super(props);
    }
    render(){
    return (
        <NavBar
        // className={[styles.navBar,this.props.className||" "].join(" ")}
        className={styles.navBar}
          mode="light"
          icon={<i className="iconfont icon-back"></i>}
          onLeftClick={() =>{this.props.onLeftClick||this.props.to(-1)}}
          // onLeftClick={() =>{this.props.onLeftClick||this.props.to('/home/list',{replace: false,state:{ id:'reactiv3'}})}}
          // rightContent={this.props.rightContent}//接收不到
        >{this.props.title}</NavBar>

    )
}
}
// 添加props校验
NavHeader.propTypes = {
    title: PropTypes.string.isRequired,
    onLeftClick: PropTypes.func,
    className: PropTypes.string,
    rightContent: PropTypes.array
  }


const mapHook= withHook(NavHeader)
export default mapHook